package com.qf.business.search.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;

import java.io.Serializable;
import java.util.Date;

/**
 * author Ken
 * create_time 2022/11/30
 */
@Document(indexName = "course_index", shards = 1, replicas = 0)
@Data
public class CourseEsEntity implements Serializable {

    @Id
    private Long id;
    //课程名称
    @MultiField(
            mainField = @Field(type = FieldType.Text, analyzer = "ik_max_word"),
            otherFields = {
                    @InnerField(suffix = "pinyin", type = FieldType.Text, analyzer = "pinyin")
            }
    )
    private String cname;
    //分类id - 外键
    @Field(type = FieldType.Long)
    private Long tpid;
    //封面
    @Field(type = FieldType.Keyword, index = false)
    private String fengmian;
    //课程价格
    @Field(type = FieldType.Double)
    private Double price;
    //课程详细介绍
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String info;
    //开课时间
    @Field(type = FieldType.Long)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date beginDate;
    //结课时间
    @Field(type = FieldType.Long)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date endDate;
}
